package cn.iocoder.yudao.module.policy.mapper;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.policy.entity.InfoDO;
import cn.iocoder.yudao.module.policy.vo.info.InfoPageReqVO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 就业政策 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface InfoMapper extends BaseMapperX<InfoDO> {

    default PageResult<InfoDO> selectPage(InfoPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InfoDO>()
                .eqIfPresent(InfoDO::getPolicyTitle, reqVO.getPolicyTitle())
                .eqIfPresent(InfoDO::getPolicyNo, reqVO.getPolicyNo())
                .eqIfPresent(InfoDO::getCoverImage, reqVO.getCoverImage())
                .eqIfPresent(InfoDO::getPublishDepartment, reqVO.getPublishDepartment())
                .betweenIfPresent(InfoDO::getPublishDate, reqVO.getPublishDate())
                .betweenIfPresent(InfoDO::getEffectiveDate, reqVO.getEffectiveDate())
                .betweenIfPresent(InfoDO::getExpiryDate, reqVO.getExpiryDate())
                .eqIfPresent(InfoDO::getPolicyStatus, reqVO.getPolicyStatus())
                .eqIfPresent(InfoDO::getViewCount, reqVO.getViewCount())
                .eqIfPresent(InfoDO::getIsTop, reqVO.getIsTop())
                .eqIfPresent(InfoDO::getIsHot, reqVO.getIsHot())
                .eqIfPresent(InfoDO::getContent, reqVO.getContent())
                .eqIfPresent(InfoDO::getCreator, reqVO.getCreator())
                .betweenIfPresent(InfoDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(InfoDO::getUpdater, reqVO.getUpdater())
                .eqIfPresent(InfoDO::getRemark, reqVO.getRemark())
                .orderByDesc(InfoDO::getPolicyId));
    }

}